ARCH := x86

ifeq ($(ARCH),x86)
CROSS_COMPILE = 
endif

ifeq ($(ARCH),csky)
CROSS_COMPILE = csky-linux-
endif

ifeq ($(ARCH),x1000)
CROSS_COMPILE = mipsel-linux-
endif

# CFLAGS =  $(MACRO_FLAGS) -O2 -fPIC -Wall -g
CFLAGS =  -g -O3 -Wall 
LDFLAGS = 

export CFLAGS
export LDFLAGS
CC = gcc
# XX = g++
AR = $(CROSS_COMPILE)ar


###############################################
#OBJS = ./aaa.o
#OBJS = $(C_SRCS:.c=.i)
C_SRCS = $(wildcard *.c lib/*.c)
C_OBJS = $(C_SRCS:.c=.o)

# CXX_SRCS = $(wildcard *.cpp lib/*.c)
# CXX_OBJS = $(CXX_SRCS:.cpp=.o)

LIBS = 

INC =  

EXTLIBS = 
EXE = main

EXE_CLIENT = wav_client

#LNKLAGS = -Wl,-Map,sona.map

all : $(EXE)
# 执行所有目标
.c.o:
	$(CC) $(CFLAGS) -c $< -o $@
#意思就是 %.o : %.c
#也就是说，所有的.o文件，依赖于对应的.c文件
%.o:%.cpp
	$(XX) $(CFLAGS) -o $@ -cpp $<

$(EXE) : $(C_OBJS) $(CXX_OBJS) $(LIBS)	
#	$(CC) $(C_OBJS) $(CXX_OBJS) -o $@
	$(CC) $(CFLAGS) $(LDFLAGS) $(INC) $(C_OBJS) $(LIBS)  $(EXTLIBS) -o $@
	# $(XX) $(LDFLAGS) $(INC) $(CXX_OBJS) $(LIBS)  $(EXTLIBS) -o $@

clean:
	rm -rf *.o
	rm -rf $(EXE)
